﻿Imports Control_Vuelos_BL
Imports Control_Vuelos_BE
Public Class frmAdm_ValijaEdicion
    Public p_CodViaje As String
    Public p_CorrelativoValija As Integer
    Public p_opcion As Integer
    Private ReadOnly _V_Valija As New V_ValijaBL()
    Private ReadOnly _V_ValijaBE As New V_ValijaBE()

    Private Sub frmAdm_ValijaEdicion_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        ModAdm_ValijaEdicion1.gCorrelativoValija.EditValue = p_CorrelativoValija
        If p_opcion = 2 Then
            ModAdm_ValijaEdicion1.LCNro.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never
            ModAdm_ValijaEdicion1.Espacio.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never
        Else
            ModAdm_ValijaEdicion1.LCNro.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always
            ModAdm_ValijaEdicion1.Espacio.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always
        End If
    End Sub

    Private Sub cmdAceptar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdAceptar.Click
        If ModAdm_ValijaEdicion1.DxValidationProvider1.Validate Then
            _V_ValijaBE.CorrelativoValija = p_CorrelativoValija
            _V_ValijaBE.CodViaje = p_CodViaje
            _V_ValijaBE.TipoValija = ModAdm_ValijaEdicion1.cbTipoValija.EditValue
            _V_ValijaBE.RemitenteValija = ModAdm_ValijaEdicion1.gRemitenteValija.EditValue
            _V_ValijaBE.DestinatorioValija = ModAdm_ValijaEdicion1.gDestinatarioValija.EditValue
            _V_ValijaBE.ObsValija = ModAdm_ValijaEdicion1.gObsValija.EditValue
            _V_ValijaBE.EstadoValija = "1"
            If p_opcion = 1 Then
                If _V_Valija.pr_AgregarValija(_V_ValijaBE) Then
                    Close()
                End If
            Else
                If _V_Valija.pr_ModificarValija(_V_ValijaBE) Then
                    Close()
                End If
            End If
        End If
    End Sub

    Private Sub cmdCancelar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdCancelar.Click
        Close()
    End Sub
End Class